package com.oracle.application.listener;

import com.alibaba.fastjson.JSONObject;
import com.oracle.application.entity.vo.OrdersVo;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class DlxListener {
    @RabbitListener(queues = "orderDlxQueue")
    @RabbitHandler
    public void dlxQueueConsumer(Channel channel, Message message){
        OrdersVo ordersVo= JSONObject.parseObject(new String(message.getBody()),OrdersVo.class);
        log.info("监听死信队列的消息订单为{}",ordersVo);
    }
}
